import request from '../utils/request';

// 获取用户余额
export const getUserBalance = () => {
  return request({
    url: '/user/balance',
    method: 'GET'
  });
};

// 生成支付二维码
export const generatePaymentQR = (data) => {
  return request({
    url: '/payment/qrcode',
    method: 'POST',
    data
  });
};

// 处理支付
export const processPayment = (data) => {
  return request({
    url: '/payment/pay',
    method: 'POST',
    data
  });
};

// 充值
export const rechargeBalance = (data) => {
  return request({
    url: '/user/recharge',
    method: 'POST',
    data
  });
};

// 获取支付记录
export const getPaymentRecords = (params = {}) => {
  return request({
    url: '/user/recharge/history',
    method: 'GET',
    params
  });
};

// 验证二维码
export const validateQRCode = (data) => {
  return request({
    url: '/payment/validate-qr',
    method: 'POST',
    data
  });
};
